﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BiliBiliCSharpStudy.old {
    class EventDemo02 {
        public static void Demo() {
            Test1();
        }
        public static void Test1() {
            Form form = new Form();
            //Controller1 controller = new Controller1(form);
            new Controller1(form);
            form.ShowDialog();
        }
    }

    class Controller1 {
        private Form form;
        public Controller1(Form form) {
            if (form != null) {
                this.form = form;
                this.form.Click += this.FormClicked;
            }
        }

        private void FormClicked(object sender, EventArgs e) {
            //throw new NotImplementedException();
            this.form.Text = DateTime.Now.ToString();
        }
    }
}
